package resolver

// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.

import (
	"context"
	"gqlt2/graph/model"

	"github.com/dgryski/trifles/uuid"
)

func (r *mutationResolver) CreateEnterprise(ctx context.Context, input model.CreateEnterpriseParam) (*model.Enterprise, error) {
	return &model.Enterprise{EnterpriseID: uuid.UUIDv4()}, nil
}

func (r *mutationResolver) UpdateEnterprise(ctx context.Context, input model.UpdateEnterpriseParam) (*model.Enterprise, error) {
	return &model.Enterprise{EnterpriseID: uuid.UUIDv4()}, nil
}

func (r *mutationResolver) RemoveEnterprise(ctx context.Context, input model.RemoveEnterpriseParam) (*model.Enterprise, error) {
	return &model.Enterprise{EnterpriseID: uuid.UUIDv4()}, nil
}

func (r *queryResolver) Enterprise(ctx context.Context, query model.EnterpriseQuery) (*model.Enterprise, error) {
	return &model.Enterprise{EnterpriseID: uuid.UUIDv4(), EnterpriseCode: uuid.UUIDv4(), EnterpriseName: uuid.UUIDv4()}, nil
}

func (r *queryResolver) EnterpriseList(ctx context.Context, query *model.EnterpriseListQuery) (*model.EnterpriseConnection, error) {
	return &model.EnterpriseConnection{
		PageInfo: &model.PageInfo{Total: 100},
		Nodes: []*model.Enterprise{&model.Enterprise{
			EnterpriseID:       uuid.UUIDv4(),
			SuperiorEnterprise: nil,
			EnterpriseCode:     uuid.UUIDv4(),
			EnterpriseName:     uuid.UUIDv4(),
		}},
	}, nil
}

func (r *queryResolver) EnterpriseDistrictStatistics(ctx context.Context, query *model.EnterpriseDistrictStatisticsQuery) ([]*model.EnterpriseDistrictStatistics, error) {
	return []*model.EnterpriseDistrictStatistics{
		&model.EnterpriseDistrictStatistics{
			District: &model.District{
				DistrictID: "adda",
				Name:       "信息",
			},
			HighWayTransport: 1,
			TravelTransport:  2,
			DangerTransport:  3,
			AroundTaxi:       4,
			OnlineTaxi:       5,
			Trunk:            6,
			MuckCar:          7,
			ConcreteCar:      8,
			RetailCar:        0,
			SchoolCar:        9,
			BusinessToNonBus: 0,
		},
	}, nil
}
